﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Photo Upload</h2>

 
    
    <h2>Subir una Foto</h2>

    <div id="dialog" title="Upload files">
        <% using (Html.BeginForm("Upload", "File", FormMethod.Post, new { enctype = "multipart/form-data" }))
           {%>
            <p><input type="file" id="fileUpload" name="fileUpload" size="23"/> </p>
            <p><input type="submit" value="Upload file" /></p>
        <% } %>
    </div>
    
<br />
<br />
    <br />
    <table width="100%">
        <tr>
            <th style="width: 163px">
                Photo</th>
            <th>
                File Name</th>
          
            
        </tr>

    <% foreach (var item in Model) {
           string fileType = System.IO.Path.GetExtension(item.Name);
           string completeURL = Request.Url.ToString() + "/../Uploads/" + Html.Encode(item.WebPath);
           %>
    
        <tr>
            <td style="width: 163px">
                <%if (fileType.ToUpper().Equals(".JPG"))
                  {%>
                  <a href="<%=completeURL%>">
                    
                     <div class="photo-container" >
                <div class="photo-top"><span></span></div>
                <div class="photo-content">
                    <div class="photo-content-right"> <img src="<%=completeURL%>" style="width:120px; height:120px;" alt="Photo Small 2" />
                        <div class="photo-caption"></div>
                    </div>
                </div>
                <div class="photo-bottom"><span></span></div>
            </div>
                  </a>
                  <%}
                 %>
            </td>
            <td style="vertical-align:middle">
               <a href="<%=completeURL%>">
               <%= Html.Encode(item.WebPath) %>
               </a>
            </td>
          
            
        </tr>
    
    <% } %>

    </table>


</asp:Content>
